<template>
  <el-dialog v-model="visible" title="配置卡商" :close-on-click-modal="false" destroy-on-close style="width: 500px">
    <el-form ref="dataFormRef" label-width="90px" :inline="true">
      <el-row>
        <el-col :span="24">
          <el-form-item prop="simType" label="卡商">
            <ma-dict-select
                v-model="dataForm.simType"
                placeholder="卡商"
                dict-type="card_type"></ma-dict-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <el-button type="primary" @click="submit()">提交</el-button>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'
import { submitApi } from '@/api/gps/recharge/recharge'
import {ElMessage} from "element-plus";

const emit = defineEmits(['refreshDataList'])

const visible = ref(false)
const dataForm = reactive({
  simType: '',
  iccid: ''
})
const dataFormRef = ref()
const init = (iccid) => {
  console.log(iccid)
  visible.value = true
  dataForm.iccid = iccid
  dataForm.simType = ''
}
function submit() {
  submitApi(dataForm).then((res) => {
    ElMessage.success({
      message: '操作完成',
      duration: 500,
      onClose: () => {
        visible.value = false
        emit('refreshDataList')
      }
    })
  })
}
defineExpose({
  init
})
</script>
<style>
.display {
  display: flex;
  flex-direction: column;
}
</style>
